1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Reference | color()


Syntax
color(r, g, b, a)
color(h, s, b, a)
color(c, m, y, k, a)
color(k, a)

DescriptionReturns a color. The color is either specified in terms of RGB, HSB, or CMYK depending on the current colormode(). The default colormode is RGB. Each RGB, HSB, or CMYK parameter ranges between 0.0 and 1.0. The last parameter is optional and sets the alpha (opacity) value. Additionally, color() can be called with just one parameter that sets the gray value. The returned color can be supplied as parameter to the fill() or stroke() command.
ReturnsColor containing the defined color values
Tutorial Colors


Example
clr1 = color(1.0, 0.0, 0.5)
fill(clr1)
rect(10, 10, 25, 25)
 
clr2 = color(0.3, 0.0, 0.4)
fill(clr2)
oval(40, 40, 40, 40)